package com.drugmanage.dao;


import com.drugmanage.Base.BaseDao;
import com.drugmanage.entity.Drug;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface DrugDao extends BaseDao<Drug>{

    int save(Drug record);

    Drug get(Integer id);

    Drug queryByDrugName(String drugname);

    @Update("update dm_drug set drugnum=drugnum-#{drugnum} where drugid=#{drugid}")
    void updateDrugNum(@Param("drugnum") Integer drugnum, @Param("drugid") Integer drugid);

    @Select("select * from dm_drug where drugid=#{drugid} and isValid=1")
    Drug getByDrugId(Integer drugid);
    @Select("select * from dm_drug where drugid=#{drugid}")
    Drug getDrugByDrugId(Integer drugid);
}